#include "splashscene.h"
#include "item/imageitem.h"
#include <QDebug>
#include <QTimer>
#include <QResource>
#include <QCoreApplication>
#include "resources.h"
#include "sound/GameSounds.h"

splashScene::splashScene(QObject *parent) :
    QGraphicsScene(parent)
{
    setSceneRect(0.0, 0.0, 640.0, 360.0);

    m_bgItem = new ImageItem(QImage(":/image/splash/loading_ch.jpg"),
                             QRect(QPoint(0,0),QImage(":/image/splash/loading_ch.jpg").size()));
    m_bgItem->setZValue(0.0);
    addItem(m_bgItem);
    QTimer::singleShot(1000,this,SLOT(Over()));
}

void splashScene::Over()
{
    QLocale locale(QLocale::system());
    resources::m_iLanguage = static_cast<int>(locale.language());
    resources::LoadData();
    resources::m_sound = new GameSounds();
    resources::LoadResource();
    QString path = QCoreApplication::applicationDirPath() + "\\Resources\\Image.rcc";
    path.replace("/","\\");

 #ifdef Q_OS_SYMBIAN
    QResource::unregisterResource(path);
 #endif

    resources::SetMain();
}
